package com.sen.controller;


import com.alibaba.fastjson.JSON;
import com.sen.entity.MyUserDetails;
import com.sen.entity.vo.poOrderVo;
import com.sen.service.StockService;
import com.sen.utils.JwtTokenUtil;
import com.sen.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 进货详细信息表
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2021-01-08 17:54:40
 */
@RestController
@RequestMapping("stock")
public class StockController {
    @Autowired
    private StockService stockService;

    /**
     * 添加采购单
     */
    @RequestMapping("/queryAll")
    public R queryAll(){
        return R.ok();
    }
    /**
     * 添加订单
     * @param poOrderJson
     * @return
     */
    @PostMapping("saveOrder")
    public R saveOrder(String poOrderJson,Double money,Integer eid){
        List<poOrderVo> poOrderVos = JSON.parseArray(poOrderJson, poOrderVo.class);
        stockService.saveOrder(poOrderVos,money,eid);
        return R.ok("success");
    }
}
